home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games: 500 MB Amiga Software
/
500 MB Amiga Software - Euber 130 - Amiga Games Disc & Mag.iso
/
userbox
/
publicdomain
/
tinymeter
/
source
/
tinymeter_prefs
/
volumes.c
< prev
Wrap
C/C++ Source or Header
|
1995-08-30
|
2KB
|
82 lines
#include <dos/dos.h>
#include <dos/dosextens.h>
char *LoadedVolList[256];
char *VolList[256];
loadsavedvols()
{
UBYTE *my_file;
int i=0;
char temp_str[255];
int j=0;
my_file=(UBYTE *)Open("ENV:TinyMeter_Volumes",MODE_OLDFILE);
if(my_file)
{
while( FGets(my_file,&temp_str[0],255L) )
{
LoadedVolList[j]=(char *)malloc(255L);
i=0;
while(temp_str[i]!=0)
{
if(temp_str[i]==10)
{
temp_str[i]=0;
break;
}
i++;
}
strcpy((char *)LoadedVolList[j],(char *)&temp_str[0]);
j++;
}
LoadedVolList[j]=0L;
Close(my_file);
}
}
getsystemvols()
{
struct DosList *dl=0L;
struct InfoData inf;
struct DevProc *devproc;
char *poke;
char my_str[256];
int j=0,p=0;
dl = (struct DosList *)LockDosList(LDF_VOLUMES|LDF_DEVICES|LDF_READ);
if(dl)
{
while ((dl = (struct DosList *) NextDosEntry(dl,LDF_VOLUMES|LDF_DEVICES)) )
{
if(dl->dol_Task)
{
BtoCStr(&my_str[0],dl->dol_Name,254L);
strcat(my_str,":");
VolList[j]=(ULONG)malloc(256L);
strcpy((char *)VolList[j],my_str);
j++;
}
}
UnLockDosList(LDF_VOLUMES|LDF_DEVICES|LDF_READ);
}
VolList[j]=(ULONG)0L;
}
freevols()
{
ULONG df=0L;
while(VolList[df])
{
free(VolList[df]);
df++;
}
df=0L;
while(LoadedVolList[df])
{
free(LoadedVolList[df]);
df++;
}
}